# Diabetes Binary Classification Demo: Feature Explanation and Preprocessing

This document explains each input field in the dataset, what it represents, and how it is preprocessed for the neural network.

| Field           | Description                                                                                                   | Type/Range         | Preprocessing Approach                |
|-----------------|--------------------------------------------------------------------------------------------------------------|--------------------|---------------------------------------|
| HighBP          | High blood pressure (0 = no, 1 = yes)                                                                        | Binary (0/1)       | Use as-is                             |
| HighChol        | High cholesterol (0 = no, 1 = yes)                                                                           | Binary (0/1)       | Use as-is                             |
| CholCheck       | Cholesterol check in last 5 years (0 = no, 1 = yes)                                                          | Binary (0/1)       | Use as-is                             |
| BMI             | Body Mass Index                                                                                              | Continuous         | Standardize (zero mean, unit variance)|
| Smoker          | Smoked at least 100 cigarettes (0 = no, 1 = yes)                                                             | Binary (0/1)       | Use as-is                             |
| Stroke          | Ever told had a stroke (0 = no, 1 = yes)                                                                     | Binary (0/1)       | Use as-is                             |
| HeartDisease    | Coronary heart disease or MI (0 = no, 1 = yes)                                                               | Binary (0/1)       | Use as-is                             |
| PhysActivity    | Physical activity in past 30 days (0 = no, 1 = yes)                                                          | Binary (0/1)       | Use as-is                             |
| Fruits          | Consume fruit 1+ times/day (0 = no, 1 = yes)                                                                 | Binary (0/1)       | Use as-is                             |
| Veggies         | Consume vegetables 1+ times/day (0 = no, 1 = yes)                                                            | Binary (0/1)       | Use as-is                             |
| HvyAlcohol      | Heavy drinker (0 = no, 1 = yes)                                                                              | Binary (0/1)       | Use as-is                             |
| AnyHealthcare   | Any health care coverage (0 = no, 1 = yes)                                                                   | Binary (0/1)       | Use as-is                             |
| NoDocbcCost     | Could not see doctor due to cost (0 = no, 1 = yes)                                                           | Binary (0/1)       | Use as-is                             |
| GenHlth         | General health (1 = excellent, 5 = poor)                                                                     | Ordinal (1–5)      | Standardize                           |
| MentHlth        | Days mental health not good (1–30)                                                                           | Ordinal (1–30)     | Standardize                           |
| PhysHlth        | Days physical health not good (1–30)                                                                         | Ordinal (1–30)     | Standardize                           |
| DiffWalk        | Difficulty walking/climbing stairs (0 = no, 1 = yes)                                                         | Binary (0/1)       | Use as-is                             |
| Sex             | 0 = female, 1 = male                                                                                         | Binary (0/1)       | Use as-is                             |
| Age             | Age group (1 = 18–24, ..., 13 = 80+)                                                                         | Ordinal (1–13)     | Standardize                           |
| Education       | Education level (1 = none/kindergarten, ..., 6 = college grad)                                               | Ordinal (1–6)      | Standardize                           |
| Income          | Income scale (1 = < $10k, ..., 8 = $75k+)                                                                    | Ordinal (1–8)      | Standardize                           |

## Target Variable

| Field            | Description                                      | Type/Range         | Preprocessing Approach                |
|------------------|--------------------------------------------------|--------------------|---------------------------------------|
| Diabetes_binary  | 0 = no diabetes, 1 = prediabetes or diabetes     | Binary (0/1)       | One-hot encode (for softmax output)   |

---

## Preprocessing Rationale

- **Binary Features:** Used as-is since they are already 0/1.
- **Ordinal/Continuous Features:** Standardized to have zero mean and unit variance to ensure all features contribute equally to training.
- **Target Variable:** One-hot encoded to match the neural network's softmax output layer.

---

## Network Architecture

- **Input:** 21 features (after preprocessing)
- **Hidden Layers:** [64, 64, 32] neurons, ReLU activation
- **Output:** 2 neurons (binary classification), softmax via loss function

---

## Evaluation Metrics

- **Accuracy:** Percentage of correct predictions on the test set.
- **Confusion Matrix:** Shows counts of true positives, true negatives, false positives, and false negatives.

---

## Notes

- All preprocessing is performed within the demo script for reproducibility.
- Standardization parameters (mean, std) are computed from the training set and applied to both train and test data.
- The script is thoroughly commented to explain each step for students.